package de.clapp.backend.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conn
{
    private static Conn instance = new Conn();

    public Connection serverCon;
    
    public Connection clientCon;

    private Conn()
    {
        try
        {
            Class.forName("org.h2.Driver");
            serverCon = DriverManager.getConnection("jdbc:h2:data\\ClApp-Server", "Clapp-App", "ViLuLi");
            serverCon.setAutoCommit(false);
            clientCon = DriverManager.getConnection("jdbc:h2:data\\ClApp-Client", "Clapp-App", "ViLuLi");
            clientCon.setAutoCommit(false);
//             Server.createTcpServer(new String[] { "-tcpPort", "5313", "-tcpAllowOthers"}).start();
        }
        catch (SQLException e)
        {
            e.printStackTrace();
        }
        catch (ClassNotFoundException e)
        {
            e.printStackTrace();
        }
    };

    public static Conn getInstance()
    {
        return Conn.instance;
    }
}
